package com.jiangyifen.robot.logger;

import org.apache.commons.lang3.StringUtils;

import com.jiangyifen.robot.websocket.WebsocketUtil;

public class WsLogger {
	
	private String color;
	
	public static final WsLogger SYSTEM = new WsLogger("silver");
	public static final WsLogger ROBOT_HIT = new WsLogger("green");
	public static final WsLogger ROBOT_NO_HIT = new WsLogger("red");
	public static final WsLogger HUMAN = new WsLogger("blue");

	private WsLogger(String color){
		this.color = color;
	}
	
	public void debug(String wsClientId, String text){
		String left = "";
		if (StringUtils.isBlank(color)) {
			left = "<p>";
		} else {
			left = "<p style=\"color:"+color+"\">";
		} 
		String result = left + text + "</p>";
		
		WebsocketUtil.unicast(wsClientId, result);
	}
}
